package com.qzsoft.zhjd.server.modules.cement.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.qzsoft.zhjd.server.modules.cement.entity.CollectCementMatchEntity;
import com.qzsoft.zhjd.server.modules.cement.mapper.CollectCementMatchMapper;
import com.qzsoft.zhjd.server.modules.cement.service.CollectCementMatchService;
import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName CementMatchServiceImpl
 * @Description 水稳生产配比业务接口实现
 * @author linhuawei
 * @since 2022-01-18
 */
@Slf4j
@Service
public class CollectCementMatchServiceImpl extends ServiceImpl<CollectCementMatchMapper, CollectCementMatchEntity>
        implements CollectCementMatchService {

    @Override
    public CollectCementMatchEntity getByStationCodeAndMatchCode(String stationCode, String matchCode) {
        if (null == stationCode || null == matchCode) {
            log.info("拌合站编号或者配方编号为空:stationCode = {}, matchCode= {}", stationCode, matchCode);
            return null;
        }
        QueryWrapper<CollectCementMatchEntity> queryWrapper = new QueryWrapper<CollectCementMatchEntity>();
        queryWrapper.eq("station_code", stationCode);
        queryWrapper.eq("match_code", matchCode);
        List<CollectCementMatchEntity> list = baseMapper.selectList(queryWrapper);
        return null == list || 0 == list.size() ? null : list.get(0);
    }

}
